﻿Public Class Form3

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        If My.Computer.FileSystem.DirectoryExists(Application.StartupPath & "\Accounts\") Then

        Else

            MkDir(Application.StartupPath & "\Accounts\")
            If My.Computer.FileSystem.DirectoryExists(Application.StartupPath & "\Accounts\" + TextboxX1.Text) Then

                MsgBox("Account already exists!")
            Else
                MkDir(Application.StartupPath & "\Accounts\" + TextboxX1.Text)

                Dim a As New System.IO.StreamWriter(Application.StartupPath & "\Accounts\" + TextboxX1.Text + "\Username.txt")
                a.WriteLine(TextboxX1.Text)
                a.Close()

                Dim b As New System.IO.StreamWriter(Application.StartupPath & "\Accounts\" + TextboxX1.Text + "\Password.txt")
                b.WriteLine(TextboxX2.Text)
                b.Close()
                MsgBox("Your account has been created!", MsgBoxStyle.Information)
            End If
            End If
    End Sub
End Class